home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
3_0
/
DOUBLEDE
/
EVENTS.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-07-28
|
3KB
|
142 lines
#include "shell.h"
/*====================================================================
handlemousedown()
determine which window (or area) was clicked in with FindWindow,
and dispatch to handling routines for the various possibilities.
====================================================================*/
handlemousedown()
{
WindowPtr whichWindow;
int Part;
switch (Part = FindWindow(event.where,&whichWindow)){
case inSysWindow: SystemClick(&event,whichWindow);
break;
case inMenuBar: domenu(MenuSelect(event.where));
break;
case inDrag: dodrag(event.where,whichWindow);
break;
case inContent: docontent(event.where,whichWindow);
break;
case inGrow: dogrow(event.where,whichWindow);
break;
case inGoAway: dogoaway(&event.where,whichWindow);
break;
case inZoomIn:
case inZoomOut: if (TrackBox(whichWindow,event.where,Part)){
HideWindow(whichWindow);
ZoomWindow(whichWindow, Part, TRUE);
if((w_index=ourwindow(whichWindow)) >= 0)
posbutton(w_index);
ShowWindow(whichWindow);
}
break;
default: break;
}
}
/*====================================================================
handlekeydown()
extract char pressed from keyboard from event.message field.
if the command key was down, dispatch to menu selection routine
in case the user was doing a menu command-key-equivalent
otherwise, ch contains the char typed from the keyboard, do
whatever is appropriate with it.
====================================================================*/
handlekeydown()
{
char ch;
int chCode;
long menuChoice,newTime;
Rect charRect;
Str255 aStr;
ch = (char)event.message & charCodeMask;
if ((event.modifiers & cmdKey) !=0)
domenu(MenuKey(ch));
else{
/*
do application dependent routine here to handle a
key pressed on the keyboard
*/
}
}
/*====================================================================
handleanevent()
event dispatcher, based on the type of event in the Event Record
====================================================================*/
handleanevent()
{
GrafPtr tempPort;
long newTime;
switch (event.what){
case mouseDown: handlemousedown();
break;
case keyDown:
case autoKey: handlekeydown();
break;
case activateEvt: handleactivate();
changedscrap();
break;
case updateEvt: handleupdate((GrafPtr)event.message);
break;
case app4Evt: dobkgnd();
break;
default: break;
}
}
/*====================================================================
noimplementation()
show dialog indicating that whatever menu item was selected is
not yet available.
====================================================================*/
noimplementation()
{
AlertTHndl theAlert;
int unneeded;
theAlert = (AlertTHndl)GetResource('ALRT',512);
centerrect(&(**theAlert).boundsRect,&screenBits.bounds);
HNoPurge(theAlert);
unneeded = NoteAlert(512,0L);
HPurge(theAlert);
}